//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing.Diagram
{
    class ConstraintAttributes
    {
        private ConstraintType _type;
        private ConstraintRelationship _for;
        private string _forName;
        private ElementType _ptType;

        public void ReadXml (ReadContext c)
        {
            _type = c.GetEnum<ConstraintType>("type");
            _for = c.GetOptionalEnum("for", ConstraintRelationship.Self);
            _forName = c.GetOptionalString("forName", string.Empty);
            _ptType = c.GetOptionalEnum("ptType", ElementType.All);

        }

        public void WriteXml(WriteContext c)
        {
            c.SetEnum<ConstraintType>("type", _type);
            c.SetOptionalEnum("for", _for, ConstraintRelationship.Self);
            c.SetOptionalString("forName", _forName, string.Empty);
            c.SetOptionalEnum("ptType", _ptType, ElementType.All);

        }
    }
}